<template>
  <div>
    {{ so_ids }}
    <div>so: {{ records }}</div>

    <!-- <a-button @click="getNC"> getNC </a-button>
    <div>NC: {{ records }}</div>

    <a-button @click="selectSome"> selectSome </a-button> -->
  </div>
</template>

<script>
import api from '@/odoorpc'

export default {
  name: 'NcTreeView',
  components: {},
  mixins: [],
  props: {
    so_ids: { type: Array, default: () => [] }
  },

  data() {
    return {
      records: []
    }
  },

  computed: {},

  created() {},

  mounted() {
    // console.log('mounted', this.$route.fullPath)
  },

  methods: {
    async getNC() {
      const Model = api.env.model('fp.nc.ods.sale.order')
      const domain = []
      const fields = ['name']
      const records = await Model.search_read({ domain, fields })
      this.records = records
    },

    async get_so(so_ids) {
      const Model = api.env.model('fp.sale.order')
      const fields = ['name']
      const records = await Model.read(so_ids, fields)
      this.records = records
    }

    // selectSome() {
    //   //
    //   this.$emit(
    //     'select',
    //     this.records.map(item => item.id)
    //   )
    // }
  }
}
</script>

<style type="text/css"></style>
